//
//  ComparisonButton.m
//  SecondPage
//
//  Created by winston on 13-4-22.
//  Copyright (c) 2013年 winston. All rights reserved.
//

#import "ComparisonButton.h"

@implementation ComparisonButton

- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self)
    {
        nameLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, frame.size.width, frame.size.height)];
        nameLabel.backgroundColor = [UIColor clearColor];
        nameLabel.textAlignment = NSTextAlignmentCenter;
        nameLabel.font = [UIFont fontWithName:@"Arial" size:14];
        [self addSubview:nameLabel];
        [nameLabel release];
        
        [self setBackgroundColor:[UIColor colorWithPatternImage:[UIImage imageNamed:@"AllAuto_Appearance_Button_Unselect"]]];
    }
    return self;
}

-(void)setTitle:(NSString*)title
{
    [nameLabel setText:title];
}

-(void)setSelected:(BOOL)selected
{
    [super setSelected:selected];
    
    if(selected)
    {
        [self setBackgroundColor:[UIColor colorWithPatternImage:[UIImage imageNamed:@"AllAuto_Appearance_Button_Select"]]];
        [nameLabel setTextColor:[UIColor whiteColor]];
    }
    else
    {
        [self setBackgroundColor:[UIColor colorWithPatternImage:[UIImage imageNamed:@"AllAuto_Appearance_Button_Unselect"]]];
        [nameLabel setTextColor:[UIColor blackColor]];
    }
    
    
}
@end
